home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F36468_takeWhile.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-20  |  2.3 KB  |  58 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:saxon="http://icl.com/saxon"
  3. exclude-result-prefixes="xsl saxon"
  4. >
  5.  
  6.   <xsl:import href="buildListWhile.xsl"/>
  7.  
  8.   <xsl:template name="takeWhile">
  9.     <xsl:param name="pList" select="/.."/>
  10.     <xsl:param name="pController" select="/.."/>
  11.     <xsl:param name="pContollerParam" select="/.."/>
  12.     <xsl:param name="pGenerator" select="/.."/>
  13.     <xsl:param name="pParam0" select="/.."/>
  14.     <xsl:param name="pParamGenerator" select="/.."/>
  15.     <xsl:param name="pElementName" select="'el'"/>
  16.  
  17.     <xsl:if test="not($pController)">
  18.       <xsl:message terminate="yes">[takeWhile]Error: pController not specified.</xsl:message>
  19.     </xsl:if>   
  20.     
  21.     <xsl:choose>
  22.       <xsl:when test="$pList">
  23.         <xsl:variable name="vAccept">
  24.           <xsl:apply-templates select="$pController">
  25.             <xsl:with-param name="pList" select="$pList[1]"/>
  26.             <xsl:with-param name="pParams" select="$pContollerParam"/>
  27.           </xsl:apply-templates>
  28.         </xsl:variable>
  29.         
  30.         <xsl:if test="string($vAccept)">
  31.            <xsl:copy-of select="$pList[1]"/>
  32.            <xsl:call-template name="takeWhile">
  33.               <xsl:with-param name="pList" select="$pList[position() > 1]" />
  34.               <xsl:with-param name="pController" select="$pController"/>
  35.               <xsl:with-param name="pContollerParam" select="$pContollerParam"/>
  36.               <xsl:with-param name="pGenerator" select="$pGenerator"/>
  37.               <xsl:with-param name="pParam0" select="$pParam0"/>
  38.               <xsl:with-param name="pParamGenerator" select="$pParamGenerator"/>
  39.               <xsl:with-param name="pElementName" select="$pElementName"/>
  40.            </xsl:call-template>
  41.         </xsl:if>
  42.       
  43.       </xsl:when>
  44.       <xsl:when test="$pGenerator">
  45.           <xsl:call-template name="buildListWhile">
  46.                 <xsl:with-param name="pList" select="/.."/>
  47.                 <xsl:with-param name="pGenerator" select="$pGenerator"/>
  48.                 <xsl:with-param name="pController" select="$pController"/>
  49.                 <xsl:with-param name="pContollerParam" select="$pContollerParam"/>
  50.                 <xsl:with-param name="pParam0" select="$pParam0"/>
  51.                 <xsl:with-param name="pParamGenerator" select="$pParamGenerator"/>
  52.                 <xsl:with-param name="pElementName" select="$pElementName"/>
  53.           </xsl:call-template>
  54.       </xsl:when>
  55.     </xsl:choose>
  56.   </xsl:template>
  57.  
  58. </xsl:stylesheet>